﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dycox.Workflows
{
    internal class StepMaintainingContext : WorkflowExecutionContext
    {
        public StepMaintainingContext(Workflow workflow, OperationArguments args)
            : base(workflow, args)
        {

        }

        protected override IWorkflowComponent GetContextComponent()
        {
            return null;
        }

        public void SetStep(WFStep step)
        {
            if (step == null)
                throw new ArgumentNullException("step");
            if (!Executing)
                throw new WorkflowException(SR.GetString("context_not_executing"));

            var cur = this.Step;

            if (cur != null && cur.ProcessId != step.ProcessId)
                throw new WorkflowException(SR.GetString("cross_process_operation"));

            base.SetComponent(step);
        }
    }
}
